package cn.itcast.day01.demo04;

/*
题目：比较两个数据是否相等
参数类型分别是type类型，shout类型，int类型，long类型。
在main测试。
 */

public class Demo02MethodOverloadSame {
    public static void main(String[] args) {
        byte a = 20;
        byte b = 20;
        System.out.println(isSame(a, b));
        System.out.println(isSame(10,20));
        System.out.println(isSame((short) 10,(short) 20));
        System.out.println(isSame(10L,20L));
    }

    public static boolean isSame(byte a, byte b) {
        System.out.println("两个byte参数");
        boolean same = a == b ? true : false;
        return same;
    }

    public static boolean isSame(short a, short b) {
        System.out.println("两个short参数");
        boolean same;
        if (a == b) {
            same = true;
        } else {
            same = false;
        }
        return same;
    }
    public static boolean isSame(int a,int b){
        System.out.println("两个int参数");
        return a == b;
    }
    public static boolean isSame(long a,long b){
        System.out.println("两个long参数");
        if (a==b) {
            return true;
        }else{
            return false;
        }
    }
}
